<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1"/>
    <title>{$appConfigs.title}</title>

    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/{$page_theme | default: 'default'}/easyui.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/style/my.css">
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/javascript/my.js"></script>
    
    <script type="text/javascript" src="{$contextPath}/invest/javascript/my.js"></script>
	<script type="text/javascript" src="{$contextPath}/assets/highcharts/highcharts.js"></script>
	<script type="text/javascript" src="{$contextPath}/assets/highcharts/modules/exporting.js"></script>
	<script type="text/javascript" src="{$contextPath}/assets/highcharts/modules/export-data.js"></script>
</head>
<body style="display:inline-block; width:98%;">
	<div id="container0" class="easyui-panel" title="价格曲线" style="width:100%;height:100%;padding:0px;">
		<div id="container0" class="easyui-panel" style="border:0;width:100%;height:10%;padding:0px;">
		{widget template="statics/assets/assets_price_inc.tpl" moduleId="invest" serviceId="AssetsService:findByIdExt" params="assets_id=`$Request.assets_id`" }
		</div>
		<div id="container1" class="easyui-panel" style="border:0;width:100%;height:90%;padding:0px;">
		</div>
	</div>
	<script type="text/javascript">
    var from_date="{$Request.from_date}";
	var url = '/invest/AssetsPriceService/findPriceByAssetsId.do?assets_id={$Request.assets_id}&from_date={$Request.from_date}';
	{literal}
	$.getJSON(url, function(data){
		var rows = data.rows;
		var categories = new Array();
		var prices = new Array();
		var cur_price, min_price, max_price;

		for(var i=0; i< rows.length; i ++) {
			categories[i] 	= rows[rows.length - 1 - i].price_date;
			prices[i]		= rows[rows.length - 1 - i].price;
			if(i == 0) {
				min_price = prices[i];
				max_price = prices[i];
			} else {
				min_price = Math.min(min_price, prices[i]);
				max_price = Math.max(max_price, prices[i]);
			}
		}
		data = [{name:'价格', type: 'spline', yAxis: 0, color: '#8888ff', data:prices }];
		var props = {"title": product_name+"的价格波动曲线图","subtitle":"时间范围：从"+from_date+"到今天","yAxis_title1":"价格","yAxis_title2":"价格"};
		showAssetsPriceChart(categories, data, 'container1', props);
		
		cur_price = prices[prices.length - 1];
		$("#cur_price").text(cur_price);
		$("#min_price").text(min_price);
		$("#max_price").text(max_price);

		var fell_rate = numberFormat((max_price- cur_price) / max_price * 100, 2);
		$("#fell_rate").text(fell_rate+"%");

		var rise_rate = numberFormat((cur_price- min_price) / min_price * 100, 2);
		$("#rise_rate").text(rise_rate+"%");
	});
	{/literal}
	</script>
</body>
</html>